package com.zhuiyun.project.api.check.controller;

import com.zhuiyun.project.annotation.OptLog;
import com.zhuiyun.project.api.check.entity.Check;
import com.zhuiyun.project.api.check.model.CheckModel;
import com.zhuiyun.project.api.check.service.CheckService;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.util.constants.CommonConstants;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/check")
@CrossOrigin
public class CheckController {

    @Autowired
    CheckService checkService;


    /**
     * @Author 小江
     * @Description //TODO 查询审核信息列表
     * @Date 10:59 2023/7/22
     **/
    @GetMapping("/getSystemList")
    @ApiOperation(value = "获取聊天列表")
    public CommonResult getSystemList(int toUserId) {
        return checkService.getSystemList(toUserId);
    }


    /**
     * @Author 小江
     * @Description //TODO 根据id获取用户的消息
     * @Date 10:59 2023/7/22
     **/
    @GetMapping("/getCheckRecord")
    @ApiOperation(value = "获取单聊的聊天记录1")
    public CommonResult getCheckRecord(int toUserId) {
        return checkService.getCheckRecord(toUserId);
    }


    /**
     * @param checkModel
     * @Author kdj
     * @Description 修改已读数
     * @Date 2023/8/6 0:46
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    @PostMapping("/isAllRead")
    CommonResult maskDel(@RequestBody CheckModel checkModel) {
        int i = checkService.maskDel(checkModel);
        if (i > 0) {
            return CommonResult.ok("修改成功");
        } else {
            return CommonResult.ok("修改失败");
        }

    }
}


